<extend name="Layout/page_home" />
<block name="content">
	<div class="row">
		<div class="col-xs-12">
			<!-- PAGE CONTENT BEGINS -->
			<div class="row">
				<div class="col-xs-12 col-sm-6 widget-container-span" id="t1">
					<div class="widget-box display-none" ></div>
					<!-- 邮件开始 -->
					<div class="widget-box" sort="11">
						<div class="widget-header">
							<h5 class="smaller">邮件</h5>
							<div class="widget-toolbar no-border">
								<ul class="nav nav-tabs" id="myTab">
									<li class="active">
										<a data-toggle="tab" href="#mail-new">最新</a>
									</li>
									<li>
										<a data-toggle="tab" href="#mail-unread">未读</a>
									</li>
								</ul>
							</div>
						</div>
						<div class="widget-body">
							<div class="widget-main">
								<div class="tab-content">
									<div id="mail-new" class="tab-pane in active ul_table">
										<ul>
											<volist name="new_mail_list" id="vo">
												<li>
													<span class="pull-right hidden-xs">{$vo.create_time|to_date='Y-m-d'}</span>
													<span  class="auto autocut"> <a url="{:U('mail/read','id='.$vo['id'])}" node="85" return_url="{:U('mail/folder/','fid=inbox')}" onclick="click_home_list(this)">{$vo.name}</a> </span>
												</li>
											</volist>
										</ul>
									</div>
									<div id="mail-unread" class="tab-pane ul_table">
										<ul>
											<volist name="unread_mail_list" id="vo">
												<li>
													<span class="pull-right hidden-xs">{$vo.create_time|to_date='Y-m-d '}</span>
													<span  class="auto autocut"> <a href="{:U('mail/read','id='.$vo['id'])}" node="85" return_url="{:U('mail/folder/','fid=inbox')}" onclick="click_home_list(this)">{$vo.name}</a> </span>
												</li>
											</volist>
										</ul>
									</div>
								</div>
							</div>
						</div>
					</div>
					<!-- 日程开始 -->
					<div class="widget-box" sort="12">
						<div class="widget-header">
							<h5 class="smaller">日程</h5>
							<div class="widget-toolbar no-border">
								<ul class="nav nav-tabs" id="myTab">
									<li class="active">
										<a data-toggle="tab" href="#calendar-todo">待办</a>
									</li>									
									<li >
										<a data-toggle="tab" href="#calendar-schedule">日程</a>
									</li>

								</ul>
							</div>
						</div>
						<div class="widget-body">
							<div class="widget-main">
								<div class="tab-content">
									<div id="calendar-schedule" class=" ul_table tab-pane ">
										<ul>
											<volist name="schedule_list" id="vo">
												<li>
													<span class="pull-right hidden-xs">{$vo.start_time|substr=0,10}</span>
													<span  class="auto autocut"> <a url="{:U('schedule/read2','id='.$vo['id'])}" node="198" return_url="{:U('schedule/index')}" onclick="click_home_list(this)">{$vo.name}</a></span>
												</li>
											</volist>
										</ul>
									</div>
									<div id="calendar-todo" class=" ul_table active tab-pane">
										<ul>
											<volist name="todo_list" id="vo">
												<li>
													<span class="pull-right hidden-xs">{$vo.end_date}</span>
													<span  class="auto autocut"> <a url="{:U('todo/edit','id='.$vo['id'])}" node="198" return_url="{:U('todo/index')}" onclick="click_home_list(this)">{$vo.name}</a> </span>
												</li>
											</volist>
										</ul>
									</div>
								</div>
							</div>
						</div>
					</div>

					<!-- 公告开始 -->
					<div class="widget-box" sort="13">
						<div class="widget-header">
							<h5 class="smaller">信息</h5>
						</div>
						<div class="widget-body">
							<div class="ul_table widget-main">
								<ul>
									<volist name="info_list" id="vo">
										<li>
											<span class="pull-right hidden-xs">{$vo.create_time|to_date='Y-m-d '}</span>
											<span  class="auto autocut"><a url="{:U('info/read','id='.$vo['id'])}" node="88" return_url="{:U('info/index')}" onclick="click_home_list(this)">【{$vo.folder_name}】{$vo.name}</a> </span>
										</li>
									</volist>
								</ul>
							</div>
						</div>
					</div>
				</div>
				<div class="col-xs-12 col-sm-6 widget-container-span" id="t2">
					<div class="widget-box display-none" ></div>
					<!-- 审批开始 -->
					<div class="widget-box" sort="21">
						<div class="widget-header">
							<h5 class="smaller">审批</h5>
							<div class="widget-toolbar no-border">
								<ul class="nav nav-tabs" id="myTab">
									<li class="active">
										<a data-toggle="tab" href="#flow-todo">待办</a>
									</li>
									<li>
										<a data-toggle="tab" href="#flow-submit">已提交</a>
									</li>
								</ul>
							</div>
						</div>

						<div class="widget-body">
							<div class="widget-main">
								<div class="tab-content">
									<div id="flow-todo" class="tab-pane in active ul_table">
										<ul>
											<volist name="todo_flow_list" id="vo">
												<li>
													<span class="pull-right hidden-xs">{$vo.create_time|to_date='Y-m-d'}</span>
													<span  class="auto autocut"> <a url="{:U('flow/read','id='.$vo['id'].'&fid=confirm')}" node="87" return_url="{:U('flow/folder','fid=confirm')}" onclick="click_home_list(this)">{$vo.name}</a> </span>
												</li>
											</volist>
										</ul>
									</div>
									<div id="flow-submit" class="tab-pane ul_table">
										<ul>
											<volist name="submit_flow_list" id="vo">
												<li>
													<span class="pull-right hidden-xs">{$vo.create_time|to_date='Y-m-d'}</span>
													<span  class="auto autocut"> <a href="{:U('flow/read','id='.$vo['id'].'&fid='.$vo['fid'].'&fid=submit')}" node="87" return_url="{:U('flow/folder','fid=submit')}" onclick="click_home_list(this)">{$vo.name}</a> </span>
												</li>
											</volist>
										</ul>
									</div>
								</div>
							</div>
						</div>
					</div>
				</div>
			</div>
		</div>
	</div>
</block>
<block name="js">
	<script src="__STATIC__/asst/modernizr-custom-v2.7.1.min.js" type="text/javascript"></script>
	<script src="__STATIC__/jquery/plugin/js/jquery-finger-v0.1.0.min.js" type="text/javascript"></script>

	<!--Include flickerplate-->
	<link href="__STATIC__/flickerplate/css/flickerplate.css"  type="text/css" rel="stylesheet">
	<script src="__STATIC__/flickerplate/js/flickerplate.min.js" type="text/javascript"></script>

	<script type="text/javascript">
		$(function() {
			if (!is_mobile()) {
				$('.widget-container-span').sortable({
					connectWith : '.widget-container-span',
					cancel : ".widget-body,.nav-tabs",
					stop : function(event, ui) {
						set_sort();
					},
					items : '> .widget-box',
					opacity : 0.8,
					revert : true,
					forceHelperSize : true,
					placeholder : 'widget-placeholder',
					forcePlaceholderSize : true,
					tolerance : 'pointer'
				});
			}
			init_sort("{$home_sort}");
		});

		function init_sort(sort_string) {
			if (sort_string == "") {
				sort_string = "11,12,13|21,22,23";
			}
			array_sort_string = sort_string.split("|");
			sort_string_1 = array_sort_string[0];
			sort_string_2 = array_sort_string[1];

			array_sort = sort_string_1.split(",");

			for (x in array_sort) {
				index = array_sort[x];
				last = $("#t1 .widget-box:last");
				current = $(".widget-box[sort='" + index + "']");
				if (index !== last.attr("sort")) {
					current.insertAfter(last);
				}
			}

			array_sort = sort_string_2.split(",");
			for (x in array_sort) {
				index = array_sort[x];
				last = $("#t2 .widget-box:last");
				current = $(".widget-box[sort='" + index + "']");
				if (index !== last.attr("sort")) {
					current.insertAfter(last);
				}
			}
		};

		function set_sort() {
			var sort_string = "";
			t1_count = $("#t1 .widget-box:not(.display-none)").length;
			t2_count = $("#t2 .widget-box:not(.display-none)").length;

			if ((t1_count == 0) || (t2_count == 0)) {
				ui_error("至少保留一个");
				location.reload(true);
				return false;
			}
			$("#t1 .widget-box").each(function() {
				sort_string = sort_string + $(this).attr("sort") + ",";
			});
			sort_string = sort_string + "|";
			$("#t2 .widget-box").each(function() {
				sort_string = sort_string + $(this).attr("sort") + ",";
			});
			sendAjax("{:U('set_sort')}", "val=" + sort_string);
		}

		$(function() {
			$('.flicker-example').flicker({
				auto_flick : true,
				dot_alignment : "right",
				auto_flick_delay : 5,
				flick_animation : "transform-slide",
				theme : "dark"
			});
		});

	</script>
</block>